{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "a 4303956272 1\n",
      "\n",
      "b 4303956272 1\n",
      "\n",
      "a 4303956304 2\n",
      "b 4303956272 1\n"
     ]
    }
   ],
   "source": [
    "# 值的id\n",
    "a = 1\n",
    "print(\"a\", id(a), a)\n",
    "b = a\n",
    "print(\"b\", id(b), b)  # b的值和值地址跟a一样\n",
    "\n",
    "print()\n",
    "\n",
    "a = 2\n",
    "print(\"a\", id(a), a)  # a的值变了之后,值地址跟着变了\n",
    "print(\"b\", id(b), b)  # b的值的内存地址不变"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 值的type\n",
    "a = 1\n",
    "print(\"a\", id(a), a)\n",
    "\n",
    "b = a\n",
    "print(\"b\", id(b), b)  # b的值和值地址跟a一样\n",
    "\n",
    "print(type(a), type(b), type(\"123\"), type(\"123\"), type(False), type(1 + 2j))"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
